package com.itboye.ihomebank.key;

import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.FrameLayout.LayoutParams;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.base.BaseOtherActivity;

/**
 * 发送密码(钥匙)
 * 
 */
public class ActivityFaSongPass extends BaseOtherActivity {
	ImageView key_title_finish;
	TextView key_title_title;
	RelativeLayout key_title_xuanze;
	TextView key_title_xuan;

	TextView fasong_time;// 时间

	LinearLayout fasong_duanxin, fasong_weixin;// 短信发送，微信发送
	
	PopupWindow window;

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.key_title_finish:
			finish();
			break;
		case R.id.key_title_xuanze:// 选择框
			PuPoWindow(v);
			break;
		case R.id.fasong_time://选择时间

			break;
		case R.id.fasong_duanxin:// 短信发送，

			break;
		case R.id.fasong_weixin:// 微信发送

			break;
		case R.id.pass_dan:// 单次
			window.dismiss();
			
			break;
		case R.id.pass_xianshi:// 限时
			window.dismiss();
			
			break;
		case R.id.pass_xunhuan://循环
			window.dismiss();
			
			break;
		case R.id.pass_yongjiu://永久
			window.dismiss();

			break;

		default:
			break;
		}

	}

	@Override
	protected int layout_id() {
		// TODO Auto-generated method stub
		return R.layout.activity_fasong_pass;
	}

	@Override
	protected void onInitController() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void onInit() {
		key_title_title.setText("发送密码");
		key_title_xuan.setText("单次");
	}

	@Override
	protected void onReadIntent(Bundle bundle) {
		// TODO Auto-generated method stub

	}
	/**
	 * 搜索切换框
	 * @param v
	 */
	private void PuPoWindow(View v) {

		View view = LayoutInflater.from(this).inflate(
				R.layout.item_pass_qiehuan, null);
		TextView pass_dan = (TextView) view.findViewById(R.id.pass_dan);
		TextView pass_xianshi = (TextView) view.findViewById(R.id.pass_xianshi);
		TextView pass_xunhuan = (TextView) view.findViewById(R.id.pass_xunhuan);
		TextView pass_yongjiu = (TextView) view.findViewById(R.id.pass_yongjiu);

		pass_dan.setOnClickListener(this);
		pass_xianshi.setOnClickListener(this);
		pass_xunhuan.setOnClickListener(this);
		pass_yongjiu.setOnClickListener(this);
		
		window = new PopupWindow(view, LayoutParams.WRAP_CONTENT,
				LayoutParams.WRAP_CONTENT);
		window.setOutsideTouchable(true);
		window.setBackgroundDrawable(new BitmapDrawable());
		window.showAsDropDown(v);
	}
}
